﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;

using ProjectBase.Core;

using Survey.Common.Data.Services;
using Survey.Entity.Services;

namespace Survey.Common.Business.Services
{
    /// <summary>
    ///     All Business checks for 'Article' on CRUD operations
    ///     are nested and encapsulated in this ArticleFacade
    /// </summary>
    public interface IArticleFacade : IBaseFacade<Article, int, ArticleFilter>
    {
        IAttachmentFacade AttachmentFacade { set; }
        IArticleCategoryFacade ArticleCategoryFacade { set; }
        IArticleGroupFacade ArticleGroupFacade { set; }

        IArticleDao Dao { set; }

        /// <summary>
        ///     Returns the Article with provided code.
        ///     Null if nothing is found
        /// </summary>
        /// <param name = "code"></param>
        /// <returns></returns>
        Article GetByCode(string code);

        /// <summary>
        ///     Returns all files, which belongs to the provided entity
        /// </summary>
        /// <param name = "entity"></param>
        /// <returns></returns>
        IEnumerable<Attachment> GetAttachments(Article entity);

        /// <summary>
        ///     Attached files are stored,
        ///     complete list of existing attachments is returned
        /// </summary>
        /// <param name = "entity"></param>
        /// <param name = "attachments"></param>
        /// <returns></returns>
        IEnumerable<Attachment> UploadFiles(Article entity, IEnumerable<Attachment> attachments);

        /// <summary>
        ///     Removes the file with the 'fileName' provided.
        ///     This file must belong to the provided Article entity.
        ///     The list fo remaining Attachments is returned
        /// </summary>
        /// <param name = "entity">Article 'containing' this attachment</param>
        /// <param name = "fileName"></param>
        /// <returns></returns>
        IEnumerable<Attachment> DeleteFile(Article entity, string fileName);

        // IoC
    }
}